package oj;

public class LC167 {
    public int[] twoSum(int[] numbers, int target) {
        int start=0;
        int end=numbers.length-1;
        int sum=0;
        int[] ret=new int[2];
        while(start<=end){
            sum=numbers[start]+numbers[end];
            if(sum>target){
                end--;
            }else if(sum<target){
                start++;
            }else{
                ret[0]=start+1;
                ret[1]=end+1;
                break;
            }
        }
        return ret;
    }
}
